<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
    	$sort=M('sort')->order('id')->select();
    	foreach($sort as $k => $v){
    		$sort1 = $sort[$k]['id'];
    		$sort[$k]['product'] = M('product')->where("parentid='$sort1'")->field('id,product,image,time')->select();
    	}

    	$musort=M('musort')->order('id')->select();
    	foreach($musort as $k => $v){
    		$sortid = $musort[$k]['id'];
    		$musort[$k]['knowid'] = M('know')->where("sort='$sortid'")->field('id,title,time')->select();
    	}
    	$this->assign('sort',$sort);
    	$this->assign('musort',$musort);
        $this->display();
    }
    public function welcome(){
        $this->display();
    }
}